package com.taxshare.seller.controller;

import com.taxshare.mybatis.pager.PageRequest;
import com.taxshare.response.beans.Response;
import com.taxshare.seller.service.SellerInvoiceRuleService;
import com.taxshare.seller.view.vo.SellerInvoiceRuleReqVO;
import com.taxshare.seller.view.vo.SellerInvoiceRuleVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/invoiceRule")
@Api(tags="开票规则")
public class SellerInvoiceRuleController {

    @Autowired
    public SellerInvoiceRuleService sellerInvoiceRuleService;

    @PostMapping("/getSellerInvoiceRuleList")
    @ApiOperation(value = "分页查询", notes = "发票拆分规则")
    public Response getSellerInvoiceRuleList(@RequestBody PageRequest<SellerInvoiceRuleReqVO> pageVo) {
        return sellerInvoiceRuleService.getSellerInvoiceRuleList(pageVo);
    }

    @PostMapping("/saveSellerInvoiceRule")
    @ApiOperation(value = "保存发票拆分规则", notes = "发票拆分规则")
    public Response<String> saveSellerInvoiceRule(@RequestBody SellerInvoiceRuleVO parames){
        return sellerInvoiceRuleService.saveSellerInvoiceRule(parames);
    }

    @GetMapping("/delSellerInvoiceRuleById")
    @ApiOperation(value = "根据id删除发票拆分规则", notes = "发票拆分规则")
    public Response<String> delSellerInvoiceRuleById(@RequestParam String uuid){
        return sellerInvoiceRuleService.delSellerInvoiceRuleById(uuid);
    }

    @PostMapping("/editSellerInvoiceRule")
    @ApiOperation(value = "编辑发票拆分规则", notes = "发票拆分规则")
    public Response editSellerInvoiceRule(@RequestBody SellerInvoiceRuleVO sellerInvoiceRuleVO){
        return sellerInvoiceRuleService.editSellerInvoiceRule(sellerInvoiceRuleVO);
    }

    @PostMapping("/disableSellerInvoiceRule")
    @ApiOperation(value = "规则禁用与启用", notes = "发票拆分规则")
    public Response disableSellerInvoiceRule(@RequestBody SellerInvoiceRuleVO sellerInvoiceRuleVO){
        return sellerInvoiceRuleService.disableSellerInvoiceRule(sellerInvoiceRuleVO);
    }


}
